import { createSSRApp } from "vue"
import Uview from "uview-plus"
import * as Pinia from "pinia"
import piniaPluginPersistedState from "pinia-plugin-persistedstate"
import "./static/styles/index.scss"
import { today } from "./utils/tools.js"
import App from "./App.vue"

export function createApp() {
	const app = createSSRApp(App)

	const pinia = Pinia.createPinia()
	app.use(Uview)
	app.use(pinia)
	pinia.use(piniaPluginPersistedState)

	// 提供 mixins 或者常量
	app.provide("imgBaseUrl", import.meta.env.VITE_APP_IMG_BASE_URL)
	app.provide("nativeBaseUrl", "http://192.168.0.17:8090/") //test
	app.provide("today", today())

	return {
		app,
		Pinia,
	}
}
